var RandomWord = new (function() {

	var ID = {
		RANDOMWORD: '.random-word',
		RESPONSE: '.random-word .response'
	};
	
	var responseDisplayed = false;
	
	this.init = function() {
		$(ID.RANDOMWORD).click(onClickWord);
		$(document).keydown(onDocumentKeyPress);
		$(ID.RANDOMWORD).mousedown(function(e) { e.preventDefault(); });
	}
	
	function onDocumentKeyPress(e) {
		if (e.which == 39) {
			onClickWord();
		}
	};
	
	function onClickWord() {
		if (!responseDisplayed) {
			$(ID.RESPONSE).css('visibility','visible');
			responseDisplayed = true;
		} else {
			window.location.reload();
		}
	};
	
	$(document).ready(this.init);
});